package example.test;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class ImportData {
//INSERT INTO m01_fin_race_region (dw_data_dt,statt_prd_cd,statt_gl_cd,total_cd,lvl1_race_cd,lvl2_race_cd,lvl3_race_cd,sale_region_cd,statt_prd_nm,statt_gl_nm,total_nm,lvl1_race_nm,lvl2_race_nm,lvl3_race_nm,sale_region_nm,busin_income,net_profit,cntrl_profit,profit_total_amt,net_assets_income_rate,total_assets_income_rate,prvs_cover_rate,capital_sufct_rate,dw_etl_job,dw_etl_time) VALUES 
//(TO_DATE('2023-08-30','YYYY-MM-DD'),'2','TJZQ_ZT_YJSD_EJQD_SJQD_XSDQ','TOTAL','1','1','2','813980','当月','统计周期_总体_一级赛道_二级渠道_三级渠道_销售大区','总体','零售','零售个人','奇瑞体系','东北区',ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),NULL,NULL,NULL,NULL,'M01_FIN_RACE_REGION','2023-09-09 15:09:11');

    static final String fsql = "INSERT INTO m01_fin_race_region (dw_data_dt,statt_prd_cd,statt_gl_cd,total_cd,lvl1_race_cd,lvl2_race_cd,lvl3_race_cd,sale_region_cd,statt_prd_nm,statt_gl_nm,total_nm,lvl1_race_nm,lvl2_race_nm,lvl3_race_nm,sale_region_nm,busin_income,net_profit,cntrl_profit,profit_total_amt,net_assets_income_rate,total_assets_income_rate,prvs_cover_rate,capital_sufct_rate,dw_etl_job,dw_etl_time,pecprovice_id,pecprovice_name) VALUES \n" +//
            "(TO_DATE('2023-08-29','YYYY-MM-DD'),'2','TJZQ_ZT_YJSD_EJQD_SJQD_XSDQ','TOTAL','1','1','2','813980','当月','统计周期_总体_一级赛道_二级渠道_三级渠道_销售大区','总体','零售','零售个人','奇瑞体系','%s',ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),ROUND(DBMS_RANDOM.VALUE(999999, 9999999999999999), 2),NULL,NULL,NULL,NULL,'M01_FIN_RACE_REGION','2023-09-09 15:09:11','%s','%s');";


    @Test
    public void t1() {
        List<String> list = new ArrayList<>();
        list.add("华北区,130000,河北省");
        list.add("华中区,140000,山西省");
        list.add("华中区,410000,河南省");
        list.add("中南区,420000,湖北省");
        list.add("西北区,150000,内蒙古自治区");
        list.add("西南区,530000,云南省");
        list.add("东北区,230000,黑龙江省");
        list.add("华东区,330000,浙江省");
        list.add("华东区,340000,安徽省");
        list.add("华南区,350000,福建省");
        list.add("华东区,320000,江苏省");
        list.add("华中区,610000,陕西省");
        list.add("西北区,620000,甘肃省");
        list.add("西北区,630000,青海省");
        list.add("西北区,640000,宁夏回族自治区");
        list.add("西北区,650000,新疆维吾尔自治区");
        list.add("东北区,220000,吉林省");
        list.add("东北区,150000,内蒙古自治区");
        list.add("华北区,370000,山东省");
        list.add("中南区,360000,江西省");
        list.add("中南区,430000,湖南省");
        list.add("华南区,440000,广东省");
        list.add("西南区,520000,贵州省");
        list.add("东北区,210000,辽宁省");
        list.add("西南区,510000,四川省");
        list.add("华北区,110000,北京市");
        list.add("华南区,450000,广西壮族自治区");
        list.add("华南区,460000,海南省");
        list.add("华东区,310000,上海市");
        list.add("西南区,500000,重庆市");
        list.add("华北区,120000,天津市");
        list.add("西南区,540000,西藏自治区");
        list.add("西南区,370000,山东省");
        list.add("华南区,330000,浙江省");


        for (String s : list) {
            String[] split = s.split(",", 3);
            String format = String.format(fsql, split[0], split[1], split[2]);
            System.out.println(format);
        }

    }
}
